package cn.itcast.demo1;

import java.io.File;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
//        File file1 = new File("D:\\java\\demo1\\FileProject\\src\\cn\\itcast\\abc\\1.txt");
//        File file1 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc/1.txt");
//        System.out.println("file1: " + file1);

//        File file2 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc","1.txt");
//        System.out.println("file2: " + file2);

//        File file3 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc");
//        File file4 = new File(file3,"1.txt");
//        System.out.println("file4: " + file4);
        System.out.println("------------------------------");

        System.out.println("创建功能");
        File file5 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc/2.txt");
        boolean flag1 = file5.createNewFile();
        System.out.println("flag1: " + flag1);
        System.out.println("------------------------------");

        File file6 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc/flag2");
        boolean flag2 = file6.mkdir();
        System.out.println("flag2: "+ flag2);
        System.out.println("------------------------------");

        File file7 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc/flag2/a/b/c");
        boolean flag3 = file7.mkdirs();
        System.out.println("flag3 :" + flag3);
        System.out.println("------------------------------");


        File file8 = new File("D:/java/demo1/FileProject/src/cn/itcast/abc/flag2/a/b");
//        boolean flag4 = file8.isDirectory();
//        System.out.println(flag4);
          System.out.println("测试file8是否是文件夹: " + file8.isDirectory());
          System.out.println("测试测试file8是否是文件: " + file8.isFile());
          System.out.println("测试测试file8是否存在: "+ file8.exists());







    }
}
